package com.lengxf.design;

public class Factory {

    //静态工厂方法
    public static Product getProduct(String args) {
        //switch 也可以理解称谓一个工厂
        return switch (args) {
            case "A" -> new ConcreteProductA();
            case "B" -> new ConcreteProductB();
            default -> throw new RuntimeException("can not find impl");
        };
    }


}
